extends Node2D

export(Vector2) var velocity_rand_range = Vector2(0.8, 1.2)
export(float) var position_rand = 1000

onready var parent = get_parent()
onready var rigid_body: RigidBody2D = $RigidBody2D
onready var timer: Timer = $Timer

func _on_Timer_timeout() -> void:
	timer.start(rand_range(4, 6))
	var emm: RigidBody2D = rigid_body.duplicate()
	parent.add_child(emm)
	emm.name = name + "!"
	emm.mode = RigidBody2D.MODE_RIGID
	emm.linear_velocity *= rand_range(velocity_rand_range.x, velocity_rand_range.y)
	emm.position = position + Vector2(randf(), randf()) * position_rand
